package main

import (
	"fmt"
	"reflect"
	"time"
)

func main02() {
	ch := make(chan int)

	chV := reflect.ValueOf(ch)

	fmt.Println(chV.Kind(), chV.Type())

	go func() {
		for i := 1; i < 10; i++ {
			chV.Send(reflect.ValueOf(i))
		}
		chV.Close()
	}()

	//for v, ok := chV.Recv(); ok; {
	//	fmt.Println("====")
	//	time.Sleep(time.Millisecond * 200)
	//	fmt.Println(v)
	//
	//}

	for v := range ch {
		fmt.Println(v)
	}

}

func main() {
	ch := make(chan int)

	chV := reflect.ValueOf(ch)

	fmt.Println(chV.Kind(), chV.Type())

	go func() {
		for i := 1; i < 9; i++ {
			ch <- i
		}
		close(ch)
	}()
	
	for v, ok := chV.Recv(); ok; {
		fmt.Println("====")
		time.Sleep(time.Millisecond * 200)
		fmt.Println(v)

	}
}
